<%= stylesheet_link_tag 'survey_ul'%>
<%= stylesheet_link_tag 'faux_table'%>
<%= hidden_field_tag 'tag_button', 'tag' %>
<%= hidden_field_tag 'year_of_survey', 'survey_year' %>
<%= hidden_field_tag 'variable_name', 'variable_name' %>
<%= hidden_field_tag 'variable_identifier', 'variable_identifier' %>
<%= hidden_field_tag 'watch_variable', 'watch_variable' %>
<div class="show_basic" style="padding-right: 2em;">
	<% if !@archived_vars.empty? %>
	The following variables have been archived and have been removed from your cart:
	<% @archived_vars.each do |item| %>
		<%= link_to item.variable.name, variable_path(item.variable) -%>
		<% end -%>
		<br/>
		<% end -%>
  <% form_remote_tag :url => { :action => "remove_from_cart"} do -%>
	<% if !@sorted_variables.empty? -%>
    <%= hidden_field_tag 'submit', 'remove_variables' %>
  <%# form_tag('/surveys/search_varsearch_variables_surveys_urliables') do -%>
  <%#= hidden_field_tag 'survey_array', @survey_list %>
  <%# if @selected_surveys!=nil %>
  <%# @selected_surveys.each do |val| %>
  <%#= hidden_field_tag "survey_list[]", val %>
  <%# end %>
  <%# end %>
    <div style="position: relative;background-color:#ACCBE0;padding-top:5px;padding-bottom:5px;padding-left:5px;width:100%;height:60px;">
      <div><%= submit_tag 'Remove selected variables from cart', :name=>"_submit", :src=>'/images/famfamfam_silk/cart_add.png', :onclick => "Form.getInputs(this.form, null,'submit')[0].value = 'remove_variables';"%>
      </div><br/>
      <div style="position: absolute; top:1em; right:1em;"><%= submit_tag 'Create Data Extract', :name=>'_submit', :onclick => "Form.getInputs(this.form, null,'submit')[0].value = 'create_archive';" -%>
      </div>
      <div>Select:
        <%= link_to_function 'All', "$$('input.variable_checkbox').each(function(checkbox) { checkbox.checked = true; });" %>
        ,&nbsp
        <%= link_to_function 'None', "$$('input.variable_checkbox').each(function(checkbox) { checkbox.checked = false; });" %>
        ,&nbsp
        <%= link_to_function 'Invert selection', "$$('input.variable_checkbox').each(function(checkbox) { if (checkbox.checked == true) {checkbox.checked = false;} else {checkbox.checked = true; } });" %>

      </div>
    </div>
    <br/>
    <br/>
    <div id="table_header" class="faux_table_header_container">
      <%= render :partial => "surveys/table_header",:locals=>{:sorted_variables => @sorted_variables} -%>
    </div>
    <div id="table_container" class="faux_table_container">
      <%= render :partial => "surveys/table",:locals=>{:sorted_variables => @sorted_variables,:lineage => true, :extract_lineage => false, :extract_id => nil} -%>
    </div>
	<% else -%>
	There are no variables in your cart, why not <%= link_to "search for some", surveys_url,:title=>"Search the data sources for variables of interest" -%>
	<% end -%>
  <% end -%>
</div>